package test;

import bean.Teacher;
import bean.Test1;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import java.io.IOException;
import java.util.List;

/**
 * @author 飞哥
 * @version V1.0
 * @package test
 * @date 2021/7/6 8:49
 */
public class TeacherTest01 {
    public static void main(String[] args) throws IOException {
        SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
        SqlSessionFactory factory = builder.build(Resources.getResourceAsStream("mybatis.xml"));
        SqlSession sqlSession = factory.openSession();

        List<Test1> list = sqlSession.selectList("dao.Test01Dao.selectTest1");
        System.out.println(list.size());

        //*****一定记得要关闭sqlSession对象*****
        sqlSession.close();
    }

}
